<template>
    <div class="centent">
        <div class="centent-top">
            <span class="iconfont icon-fangdajing" @click="fun()"></span>
            <span class="tui">推荐</span>
            <span class="iconfont icon-zhaoxiangji"></span>
        </div>  
        <div class="centent-centent">
            <ul class="infinite-list" v-infinite-scroll="load" style="overflow:auto">
    <li v-for="(v,i) in datas" :key="i" class="infinite-list-item"><img :src="v.imgs" alt=""></li>
  </ul>
  
        </div>
        <div>
        <Footer/>
    </div>
    </div>
    
</template>

<script>
// import getLink from "@/apis/getapi"
export default {
    computed:{
datas(){
    return this.$store.state.Purchase.map
}
    },
    created(){
        if (sessionStorage.getItem("store")) {
      this.$store.replaceState(
        Object.assign(
          {},
          this.$store.state,
          JSON.parse(sessionStorage.getItem("store"))
        )
      );
    }
    window.addEventListener("beforeunload", () => {
      sessionStorage.setItem("store", JSON.stringify(this.$store.state));
    });
         this.$store.dispatch("Purchasemap", { url: "/map" });
         console.log(this.$store.state.Purchase.map);
    }, data () {
      return {
        count: 0,
      }
    },
    methods:{
        fun(){
            this.$router.push("/Purchase/Input")
        },
        load () {
        this.count += 2
      }
    }
}
</script>

<style scoped>
ul{
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: .3rem;
    margin-top: .2rem;
}
li{
    width: 50%;
    margin: auto;
    margin-top: .2rem;
}
li img{
    width: 100%;
}
.centent-son{
    width: 47%;
    height: auto;
    background: turquoise;
}
.centent-centent1{
    height: 30rem;
    display: flex;flex-wrap: wrap;
    justify-content: space-evenly;
}
.centent-centent{
    width: 90%;
    flex: 1;
    margin: auto;
    margin-top: .6rem;
}
.tui{
    width: 50%;
}
.centent-top span{
    text-align: center;
    font-size: .18rem;
}
.centent-top span:nth-child(1){
    width: 25%;
}
.centent-top span:nth-child(3){
    width: 25%;
}
.centent{
     display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: scroll;
  width: 100%;
  position: relative;
    
}
    .centent-top{
        width: 100%;
        height: .6rem;
        position: fixed;
        top: 0rem;
        display: flex;
        align-items: center;
        background: white;
    }
</style>